package com.myx.design.single.realization;

/**
 * 描述:单例模式-静态内部类
 * @author: myx
 * @date: 2018/11/28
 * Copyright © 2018-hotpot. All rights reserved.
 */
public class UserSingleStatic {
    private UserSingleStatic(){
        System.out.println("私有化构造函数");
    }
    public static class UserSingleStaticInstance{
        private static final UserSingleStatic userSingleStatic =new UserSingleStatic();
    }
    public static UserSingleStatic getInstance(){
        return UserSingleStaticInstance.userSingleStatic;
    }
    public static void main(String[] args) {
        System.out.println(UserSingleStatic.getInstance()==UserSingleStatic.getInstance());
    }
}
